import React, { Component } from 'react'
import {
    Switch,
    Route,
    Redirect,
    // NavLink
} from 'react-router-dom'
// import { Tabbar } from 'react-vant';
export default class RouterView extends Component {
    static defaultProps={
        routes:[]
    }
    render() {
        const {routes}=this.props
        return (
            <div>
                <Switch>
                    {
                        routes.length && routes.map((item,idx)=>{
                            return item.path ? <Route key={idx} path={item.path} render={(props)=><item.component {...props} routes={item.children}/>}/>
                            : <Redirect key={idx} {...item} exact/>
                        })
                    }
                </Switch>
            </div>
        )
    }
}
